﻿namespace Vin.Extension.SqlSugar.Extension;

public static class VinSqlFuncExtension
{
    /// <summary>
    /// 聚合去重求和
    /// </summary>
    public static TResult AggregateDistinctSum<TResult>(TResult value) =>
        throw new NotSupportedException("Can only be used in expressions");

    public static TResult AggregateDistinctSumNoNull<TResult>(TResult value) =>
        throw new NotSupportedException("Can only be used in expressions");

    /// <summary>
    /// 聚合后拼接字符串
    /// </summary>
    /// <param name="value"></param>
    /// <typeparam name="TResult"></typeparam>
    /// <returns></returns>
    /// <exception cref="NotSupportedException"></exception>
    public static TResult GroupConcat<TResult>(TResult value) =>
        throw new NotSupportedException("Can only be used in expressions");

    /// <summary>
    /// json 包含
    /// </summary>
    /// <param name="json"></param>
    /// <param name="value"></param>
    public static bool JsonContains(object? json, object? value) =>
        throw new NotSupportedException("Can only be used in expressions");

    /// <summary>
    /// json 提取变量 并对比 
    /// </summary>
    /// <param name="json"></param>
    /// <param name="path">$.a</param>
    /// <param name="value"></param>
    public static bool JsonExtract<T>(object? json, object? path, T value) =>
        throw new NotSupportedException("Can only be used in expressions");

    /// <summary>
    ///  json 提取变量 并对比 like
    /// </summary>
    /// <param name="json"></param>
    /// <param name="path"></param>
    /// <param name="value"></param>
    /// <typeparam name="T"></typeparam>
    /// <returns></returns>
    /// <exception cref="NotSupportedException"></exception>
    public static bool JsonExtractLike<T>(object? json, object? path, T value) =>
        throw new NotSupportedException("Can only be used in expressions");
}